﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using guardaLinks.AccesoDatos;
using guardaLinks.Logica;



namespace guardaLinks.Presentacion
{
    /// <summary>
    /// Lógica de interacción para escribirLink.xaml
    /// </summary>
    public partial class escribirLink : Window
    {
        public escribirLink()
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
        }

        
       

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if(tbtitulo.Text == "")
            {
                MessageBox.Show("Porfavor ingrese un titulo");
                tbtitulo.Focus();
            }
            if (tblink.Text == "")
            {
                MessageBox.Show("Porfavor ingrese un link para guardar");
                tblink.Focus();
            }
            else
            {

                IngresarLink ing = new IngresarLink();
                ing.guardar(id, tbtitulo.Text, tblink.Text);
                MessageBox.Show("Su link ha sido guardado satisfactoriamente");
                tbtitulo.Text = "";
                tblink.Text = "";
            }

   
        }
        
        int id;
        private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
           
            string getcbxvalue = (cbx.SelectedItem as ComboBoxItem).Content.ToString();
            if (getcbxvalue == "Juegos")
            {
                id = 1;           
            }
            if (getcbxvalue == "Deportes")
            {
                id = 2;
            }
            if (getcbxvalue == "Peliculas")
            {
                id = 3;
            }
            if (getcbxvalue == "Anime")
            {
                id = 4;
            }
            if (getcbxvalue == "Politica")
            {
                id = 5;
            }
            if (getcbxvalue == "Paranormales")
            {
                id = 6;
            }
            if (getcbxvalue == "Ciencias")
            {
                id = 7;
            }
            if (getcbxvalue == "Historia")
            {
                id = 8;
            }
            if (getcbxvalue == "Literatura")
            {
                id = 9;
            }
            if (getcbxvalue == "Otros")
            {
                id = 10;
            }
            
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            menu abrirMenu = new menu();
            abrirMenu.Show();
            this.Close();
        }
    }
}
